package main

import "fmt"

// map获取
// value,flag :=map[key]
func main() {
	var map1 = map[int]string{1: "张三", 2: "李四", 3: "王五"}
	value, flag := map1[3]
	if flag {
		fmt.Println(value)
	} else {
		fmt.Println("不存在")
	}
	fmt.Println(map1)
	delete(map1, 3)
	fmt.Println(map1)
	// 遍历
	for key, value := range map1 {
		fmt.Println(key)
		fmt.Println(value)
	}
}
